package com.lin.service.impl;

import com.lin.common.context.BaseContext;
import com.lin.entity.AlbumEntity;
import com.lin.entity.CollectionEntity;
import com.lin.mapper.AlbumMapper;
import com.lin.mapper.CollectionMapper;
import com.lin.service.AlbumService;
import com.lin.service.CollectionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AlbumServiceImpl implements AlbumService {

    @Autowired
    private AlbumMapper albumMapper;
    /**
     * 获取相册
     * @return
     */
    public AlbumEntity getAlbum(Integer userId) {
        return albumMapper.getAlbum(userId);
    }

    /**
     * 新建相册
     * @param albumEntity
     */
    public void saveAlbum(AlbumEntity albumEntity) {
        albumEntity.setCreatePId(BaseContext.getCurrentId());
        albumMapper.saveAlbum(albumEntity);
    }

    /**
     * 更新相册
     * @param albumEntity
     */
    public void updateAlbum(AlbumEntity albumEntity) {
        albumMapper.updateAlbum(albumEntity);
    }

    /**
     * 删除相册
     * @param id
     */
    public void deleteAlbum(Integer id) {
        albumMapper.deleteAlbum(id);
    }

}
